package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.common.vo.eduStudentEnrollPre.EduStudentEnrollPreVO;
import com.jwsoft.manager.core.integration.EduStudentEnrollPreOfflineIntegration;
import com.jwsoft.manager.common.vo.eduStudentEnrollPreOffline.EduStudentEnrollPreOfflineVO;
import com.jwsoft.manager.common.vo.eduStudentEnrollPreOffline.EduStudentEnrollPreOfflineKeyVO;
import com.jwsoft.manager.common.vo.eduStudentEnrollPreOffline.EduStudentEnrollPreOfflineQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 线下新生登记网关
 *
 * @author wangt
 * @since 2024-06-06
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "线下新生登记", description = "线下新生登记")
public class EduStudentEnrollPreOfflineController {

    @Autowired
    public EduStudentEnrollPreOfflineIntegration eduStudentEnrollPreOfflineIntegration;

    @Operation(summary = "线下新生登记分页查询",description = "线下新生登记分页查询")
    @PostMapping(value = "/eduStudentEnrollPreOffline0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduStudentEnrollPreOfflineVO>> getList(@RequestBody @Validated EduStudentEnrollPreOfflineQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollPreOfflineIntegration.getList(vo));
    }

    @Operation(summary = "线下新生登记根据主键查询详情",description = "线下新生登记根据主键查询详情")
    @PostMapping(value = "/eduStudentEnrollPreOffline0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollPreOfflineVO> getById(@RequestBody @Validated EduStudentEnrollPreOfflineKeyVO vo) {
        return AppResponse.successData(eduStudentEnrollPreOfflineIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "线下新生登记新增",description = "线下新生登记新增")
    @PostMapping(value = "/eduStudentEnrollPreOffline0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollPreOfflineVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduStudentEnrollPreOfflineVO vo) {
        return AppResponse.successData(eduStudentEnrollPreOfflineIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "线下新生登记修改",description = "线下新生登记修改")
    @PostMapping(value = "/eduStudentEnrollPreOffline0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollPreOfflineVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduStudentEnrollPreOfflineVO vo) {
        return AppResponse.successData(eduStudentEnrollPreOfflineIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "线下新生登记删除",description = "线下新生登记删除")
    @PostMapping(value = "/eduStudentEnrollPreOffline0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduStudentEnrollPreOfflineKeyVO vo) {
        eduStudentEnrollPreOfflineIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "线下准新生登记保存",description = "线下准新生登记保存")
    @PostMapping(value = "/eduStudentEnrollPreOffline0010", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduStudentEnrollPreVO> savePre(@RequestBody @Validated(value = {Validators.Add.class}) EduStudentEnrollPreOfflineVO vo) {
        return AppResponse.successData(eduStudentEnrollPreOfflineIntegration.savePre(vo));
    }
}
